﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Battleship
{
    public class ContainerSlot
    {
        public ContainerInfo container;
        public SlotPoint location;
        public int pType;
        public Cor GCor;
        public Moment moment;
        public bool isTail;
        public ContainerSlot()
        {
            container = null;
            location = new SlotPoint(0, 0, 0);
            pType = 0;
            GCor = new Cor(location);
            valMoment();
            isTail = false;
            valMoment();
        }
        public ContainerSlot(int tier, int bay, int row)
        {
            container = null;
            location = new SlotPoint(tier, bay, row);
            pType = 0;
            GCor = new Cor(location);
            valMoment();
            isTail = false;
            valMoment();
        }
        public Moment valMoment()
        {
            if (this.container == null)
            {
                moment = new Moment(0, 0, 0);
            }
            else
            {
                if (this.container.Size == 40 && ((this.location.bay % 2) != 0))
                {
                    moment = new Moment(0, 0, 0);
                }
                else
                {
                    double xm = GCor.x * 6.1 + container.LCor.x * 6.1;
                    double ym = GCor.y * 2.44 + container.LCor.y * 2.44;
                    double zm = GCor.z * 2.44 + container.LCor.z * 2.44;
                    moment = new Moment(xm, ym, zm);
                }
            }
            return moment;
        }
    }
}
